#ifndef __PAGE_H_
#define __PAGE_H_

#include "Record.h"
#include "TwoWayList.h"

#ifndef PAGESIZE
#define PAGESIZE 8192
//#define PAGESIZE 131072
#endif /* PAGESIZE */

class Page {

        TwoWayList <Record> myRecs;
        int numRecs;
        int curSizeInBytes;

public:

        // this takes a page and writes its binary representation to bits
        void ToBinary (char *bits);

        // this takes a binary representation of a page and gets the
        // records from it
        void FromBinary (char *bits);

        // the deletes the first record from a page and returns it; returns
        // a zero if there were no records on the page
        int GetFirst (Record &firstOne);

        // this appends the record to the end of a page.  The return value
        // is a one on success and a aero if there is no more space
        // note that the record is consumed so it will have no value after
        int Append (Record &addMe);

        // empty it out
        void EmptyItOut ();

        // constructor
        Page ();
		
		// copy constructor so page can be used in STL
		Page (Page& p);
		
		Page (const Page& p);
		
		~Page();

};



#endif /* __PAGE_H_ */
